package dao.impl;

import dao.BaseDao;
import dao.Order_contentDao;
import pojo.Order_content;

import java.util.List;

public class Order_contentDaoImpl extends BaseDao implements Order_contentDao {
    @Override
    public int addOrder_content(Order_content order_content) {
        String sql="insert into order_content values (?, ?, ?, ?, ?);";
        return baseUpdate(sql,order_content.getCon_id(),
                order_content.getOrd_no(),order_content.getDi_name(),
                order_content.getDi_num(),order_content.getFi_price());
    }

    @Override
    public List<Order_content> findAllOrder_contentBybus_no(Integer bus_no) {
        String sql="select con_id,order_content.ord_no,di_name,di_num,fi_price " +
                "FROM orders join order_content " +
                "on (orders.ord_no=order_content.ord_no) WHERE orders.bus_no=?;";
        return baseQuery(Order_content.class,sql,bus_no);
    }
}
